<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="f"%>
<%@ taglib uri="/mytag" prefix="yjd"%>
<div class="wrap">
    <div class="h_a">后台用户充值</div>
    <!-- start -->
    <form method="post" id="userForm" class="J_ajaxForm" autocomplete="off" action='<yjd:url url="/user/adminRecharge/submit"/>'>
        <div class="table_full">
            <table width="100%">
                <tr>
                    <th width="200">用户手机号:</th>
                    <td>
                        <input name="mobile" type="text" class="input length_5">
                    </td>
                </tr>
                <tr>
                    <th width="200">银行卡号:</th>
                    <td>
                        <input name="bank_no" type="text" class="input length_5">
                    </td>
                </tr>
                <tr>
                    <th width="200">持卡人姓名:</th>
                    <td>
                        <input name="idname" type="text" class="input length_5">
                    </td>
                </tr>
                <tr>
                    <th width="200">持卡身份证号:</th>
                    <td>
                        <input name="id_card" type="text" class="input length_5">
                    </td>
                </tr>
                <tr>
                    <th width="200">充值金额:</th>
                    <td>
                        <input id ="price" name="price" type="text" class="input length_5">（单位：元）
                    </td>
                </tr>
            </table>
        </div>
        <div class="btn_wrap">
            <div class="btn_wrap_pd">
                <input id="submitbutton" class="btn btn_submit mr10 " type="button" onclick="cofrim()" value="确认充值"/>
            </div>
        </div>
    </form>
    <script>
        function cofrim() {
            var price  =  $("#price").val();
            var msg = '请确认是否充值'+price+'元?';
            var btn = $("#submitbutton");

            art.dialog({
                    id:"J_ajax_submit_btn",
                    content:msg,
                    ok:function() {
                        $("#userForm").ajaxSubmit({
                            url:$("#userForm").attr("action"),
                            //按钮上是否自定义提交地址(多按钮情况)
                            dataType:"json",
                            beforeSubmit:function(arr, options) {
                                var text = btn.val();
                                //按钮文案、状态修改
                                btn.val(text + "中...").prop("disabled", true).addClass("disabled");
                            },
                            success:function(data, statusText, xhr) {
                                var text = btn.val();
                                //按钮文案、状态修改
                                btn.removeClass("disabled").val(text.replace("中...", "")).parent().find("span").remove();
                                if (data.state == "1") {
                                    $('<span class="tips_success">' + data.message + "</span>").appendTo(btn.parent()).fadeIn("slow").delay(1e3).fadeOut(function() {
                                        if (data.referer) {
                                            //返回带跳转地址
                                            window.location.href = decodeURIComponent(data.referer);
                                        } else {
                                            reloadPage(window);
                                        }
                                    });
                                } else if (data.state == "0") {
                                    $('<span class="tips_error">' + data.message + "</span>").appendTo(btn.parent()).fadeIn("fast");
                                    btn.removeProp("disabled").removeClass("disabled");
                                }
                            }
                        });
                    },
                   cancel:function() {
                       return;
                   }
            });
        }
    </script>
</div>